/**
 * 路由数据
 * @doc https://serializedowen.com/docs/react-router-dom/API/route/#exact-bool
 */

import { lazy } from 'react'

const Layout = lazy(() => import('@/layout/Layout'))
const Error404 = lazy(() => import('@/views/Error/Error404'))
const Login = lazy(() => import('@/views/Login/Login'))
const Home = lazy(() => import('@/views/Home/Home'))
const Demo = lazy(() => import('@/views/Demo'))
const Form = lazy(() => import('@/views/Form'))

/*
{
  name: 'Home',
  path: '/home',
  title: '首页',
  icon: '',
  iconActive: '',
  component: Home,
  isExact: true, // 精确的
  requireAuth: false, // 是否需要身份验证: true:需要登录; false/空:不需要身份验证;
  roles: ['admin'], // 什么角色才能访问
  hidden: false, // 显示在菜单中: true:不显示; false/空:显示;
  breadcrumb: ['/home'],
  redirectPath: ''
}
*/
export const rootRoutes = [
  { path: '/login', component: Login },
  { path: '/', component: Layout },
  { path: '/404', component: Error404 },
  // { path: '/', redirectPath: '/layout' },
  { path: '*', redirectPath: '/404' },
]

export const iframeRoutes = [
  {
    path: '/home',
    title: '首页',
    component: Home,
    requireAuth: true
  },
  {
    path: '/demo',
    component: Demo,
    title: '案例',
    requireAuth: true
  },
  {
    path: '/form',
    component: Form,
    title: '表单',
    requireAuth: true
  },
  { path: '/', redirectPath: '/home', hidden: true },
  { path: '*', redirectPath: '/404', hidden: true },
]

export const routePathMap = {
  home: '/'
}

// 跟路由路径保持一致
export const routeNameMap = {
  "/": "首页",
  "/demo": "案例",
  "/form": "表单",
  "/403": "403",
  "/404": "404",
}
